mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-20 09:01:39 -08:00
Use a BroadcastReceiver to get the battery info instead of polling
This commit is contained in:
1 parent
c011c18411
commit
a5fda396b9
7 files changed
+55
-88
No files matched your search
@@ -2,8 +2,6 @@ package org.meumeu.wivrn;
|
||||
|
||||
public class MainActivity extends android.app.NativeActivity
|
||||
{
|
||||
public static native void sendMessageFromJava(String msg, String arg);
|
||||
|
||||
static
|
||||
{
|
||||
System.loadLibrary("wivrn");
|
||||
@@ -14,4 +12,16 @@ public class MainActivity extends android.app.NativeActivity
|
||||
|
||||
@Override
|
||||
public native void onNewIntent(android.content.Intent intent);
|
||||
|
||||
private android.content.BroadcastReceiver BatteryInfoReceiver = null;
|
||||
|
||||
@Override
|
||||
protected void onCreate(android.os.Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
this.BatteryInfoReceiver = new BroadcastReceiver();
|
||||
|
||||
this.registerReceiver(this.BatteryInfoReceiver, new android.content.IntentFilter(android.content.Intent.ACTION_BATTERY_CHANGED));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user