开发者

Android register to remote server on first application uses

开发者 https://www.devze.com 2022-12-29 19:05 出处:网络
I am writing a android application where I want to register my application to remoter server when application is first launched on installation. Application will register to remoter server itself with

I am writing a android application where I want to register my application to remoter server when application is first launched on installation. Application will register to remoter server itself without taking any user input. How Can I track whether this is a first开发者_运维百科 application launch after installation ?


By setting a shared preference:

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = prefs.edit();
edit.setBoolean("launched", true);
edit.commit();

You can check for it on each launch with:

boolean launched = prefs.getBoolean("launched", false);
0

精彩评论

暂无评论...
验证码 换一张
取 消