2019-09-12 Thursday

今日,我用flutter编写一个ios/android应用,并在三星note8上运行时,突然发现应用启动后,屏幕上显示的不是

Flutter Demo Home Page

而是

Welcome to Game Tools

我点击屏幕右下角的 < 后,屏幕倒是切换到flutter应用了,然而,屏幕左下角还是比其他应用多了一个图标。即     的左侧图标,在其他应用中不会出现,而且,点击该图标后,手机就会启动游戏工具(Game Tools)

我搜索Stackoverflow后,发现,React Native的应用也有类似情况

React Native app is recognized as a game on Samsung Note8

https://stackoverflow.com/questions/49287871/react-native-app-is-recognized-as-a-game-on-samsung-note8

I think there are few possibilities.
you (or one of your dependencies) have included the google play service API which inside of play service API has a module named games that samsung will automatically treat it as game.
You could find which of your dependency is loading google play service API and create a exclude like:
compile (project ('your.dependency')){ exclude group: 'com.google.android.gms', module:'play-services-game' }
Your application id (can see on build.gradle) is registered on samsung game database. You could check by going into playstore and search for your application id

不过,我检查了flutter的依赖(dependencies),并没有发现play-services-game。难道,真的是application id被三星识别为游戏的id了吗。

我检查了flutter默认的app id,该id为com.example.app,我将该值改为com.example.app,并重新编译运行应用。结果,我发现,当app id为com.example.app时,三星的游戏工具就会出现,而app id为com.example.app111时,三星的游戏工具就不会出现。

看来,com.example.app的确已经注册到三星的游戏数据库中( is registered on samsung game database. )了。还好,我们正常发布的应用不会使用com.example.app,所以,我们无需担心flutter编写的应用会触发三星的游戏工具(Game Tool)。