मैं Google Play पर दो अलार्म घड़ी ऐप्स का डेवलपर हूं। मैं उन्हें एंड्रॉइड 6.0 के साथ काम करने की कोशिश कर रहा हूं। हालांकि, डोज़ मोड इसे बनाता है ताकि वे रिंग न करें। मैंने उन्हें सफेद सूची में रखा, मैंने एक अग्रभूमि अधिसूचना आइकन रखा, मुझे यकीन नहीं है कि मैं और क्या कर सकता हूं - जब डोज़ मोड में, अलार्म प्रबंधक अलार्म अभी भी अनदेखा कर रहे हैं। क्लॉक ऐप (जो एओएसपी ऐप की बजाय Google Play है), हालांकि, अलग है। जब क्लॉक ऐप पर अलार्म सक्षम होता है, तो "adb deviceidle step" हमेशा "सक्रिय" पढ़ेगा और कभी भी "निष्क्रिय", "idle_pending" या कुछ और नहीं पढ़ेगा।डोज़ मोड में एंड्रॉइड 6.0 के दौरान अलार्म प्रबंधक कैसे काम करें?
क्या एंड्रॉइड यहां धोखा दे रहा है, अपना ऐप अधिक शक्ति, उर्फ दे रहा है। "एक सेब खींच रहा है"? क्या Google Play पर सभी अलार्म घड़ी ऐप्स गैर-कार्यात्मक बनने वाले हैं? यहां चिंतित होने के कारण, ये गुणवत्ता वाले ऐप्स हैं जिन्हें प्रत्येक ने अंशकालिक विकास के समय का एक वर्ष लिया, और मेरे लिए बड़े आय स्रोत हैं। इस बात पर कोई संकेत है कि मैं इन्हें कैसे काम कर सकता हूं, यह एक बड़ी मदद होगी।
AlarmManager आशय की स्थापना:
Intent intent = new Intent(context, ReceiverAlarm.class);
if (android.os.Build.VERSION.SDK_INT >= 16) {
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
}
amSender = PendingIntent.getBroadcast(context, 1, intent, PendingIntent.FLAG_CANCEL_CURRENT); //FLAG_CANCEL_CURRENT seems to be required to prevent a bug where the intent doesn't fire after app reinstall in KitKat
am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, scheduleToTime+1, amSender);
और ReceiverAlarm वर्ग:
public class ReceiverAlarm extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
if (wakeLock == null) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Theme.appTitle);
wakeLock.acquire();
}
X.alarmMaster.startRingingAlarm(true);
}
और X.alarmMaster.startRingingAlarm के प्रासंगिक भागों() विधि:
if (wakeLock == null) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Theme.appTitle);
wakeLock.acquire();
}
if (screenWakeLock == null) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
screenWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, Theme.appTitle+" scr");
screenWakeLock.acquire();
}
Intent alarmIntent = new Intent(Intent.ACTION_VIEW);
alarmIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
alarmIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
alarmIntent.setClass(context, ActivityAlarmAlarm.class);
context.startActivity(alarmIntent);
आसान पठनीयता के लिए कुछ तरीकों को इनलाइन चिपकाया गया है।
कुछ के टुकड़े मदद कर सकते हैं अन्य लोगों के देखने कि क्या हो रहा है की सुविधा देता है। कृपया :-) – Nabin
निश्चित रूप से, मैं अपनी प्रतिक्रिया संपादित करूंगा। वे 20k + कोड कोड हैं, इसलिए मैं उनमें से एक के लिए प्रासंगिक लाइनों को पोस्ट करने का प्रयास करूंगा। – user1908060