android - set live wallpaper on app install -


i trying multiple solutions requiring user interaction set live wallpaper (i don't want user interaction), want set automatically on first run of application means right after installation not on opening app done through keeping record in preference.

i used following code make happen requiring user interaction.

    sharedpreferences p = preferencemanager             .getdefaultsharedpreferences(this);     boolean firstrun = p.getboolean(preference_first_run, true);     if (firstrun) {         p.edit().putboolean(preference_first_run, false).commit();          try {              intent intent = new intent(                     wallpapermanager.action_change_live_wallpaper);             componentname component = new componentname(this,                     mywallpaperservice.class);              intent.putextra(                     wallpapermanager.extra_live_wallpaper_component,                     component);             startactivityforresult(intent, 0);          } catch (exception e) {             toast.maketext(this, "error setting wallpaper",                     toast.length_short).show();         }     } 

please guide me if there way of doing this, thanks

i don't know whether idea or not can put logic in oncreate(). when activity start/launch called everytime.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -