[DEV] Low Level System functions - permission problems - Nexus One Android Development

Hi
I'm trying to write an application that puts my device into sleep since my powerbutton is broken. (Thanks no option to return etc.)
Now when i try to tell my phone to go to sleep using:
Code:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
pm.goToSleep(0);
I'm getting the below error. How can I make it work?
I was told I need to sign the app with the rom key to use such low level system functionality. How can I do that, where can I get the key?
Is this possible for stock rom, CM6?
Thanks for you help
Code:
I/ActivityManager( 111): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.sl33p/.sl33p }
W/ActivityManager( 111): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.sl33p/.sl33p } from ProcessRecord{4415
cd90 14332:android.process.acore/10068} (pid=14332, uid=10068) requires android.permission.DEVICE_POWER
E/Launcher(14332): Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.sl33p/.sl33p }. Make sure
to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity.
E/Launcher(14332): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.sl33p/.sl33p } f
rom ProcessRecord{4415cd90 14332:android.process.acore/10068} (pid=14332, uid=10068) requires android.permission.DEVICE_POWER
E/Launcher(14332): at android.os.Parcel.readException(Parcel.java:1247)
E/Launcher(14332): at android.os.Parcel.readException(Parcel.java:1235)
E/Launcher(14332): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
E/Launcher(14332): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
E/Launcher(14332): at android.app.Activity.startActivityForResult(Activity.java:2817)
E/Launcher(14332): at com.fede.launcher.Launcher.startActivityForResult(Launcher.java:2783)
E/Launcher(14332): at android.app.Activity.startActivity(Activity.java:2923)
E/Launcher(14332): at com.fede.launcher.Launcher.startActivity(Launcher.java:3751)
E/Launcher(14332): at com.fede.launcher.Launcher.startActivitySafely(Launcher.java:3736)
E/Launcher(14332): at com.fede.launcher.AllAppsGridView.onItemClick(AllAppsGridView.java:1096)
E/Launcher(14332): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/Launcher(14332): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
E/Launcher(14332): at android.os.Handler.handleCallback(Handler.java:587)
E/Launcher(14332): at android.os.Handler.dispatchMessage(Handler.java:92)
E/Launcher(14332): at android.os.Looper.loop(Looper.java:123)
E/Launcher(14332): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/Launcher(14332): at java.lang.reflect.Method.invokeNative(Native Method)
E/Launcher(14332): at java.lang.reflect.Method.invoke(Method.java:521)
E/Launcher(14332): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/Launcher(14332): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/Launcher(14332): at dalvik.system.NativeStart.main(Native Method)

i was wondering the same, since my power button is dead, but was told by some devs that the system wont allow apps to put system into a sleep state.

the error says it all: android.permission.DEVICE_POWER
put this permission in your manifest and it should be fine.

Adding the permission isn't enough in this case, I think.
Isn't this permission granted to the system only ?
If it is, you'll need to sign the application with the CyanogenMod SDK key.
And it'll work only on CM.

Zappletoo said:
Adding the permission isn't enough in this case, I think.
Isn't this permission granted to the system only ?
If it is, you'll need to sign the application with the CyanogenMod SDK key.
And it'll work only on CM.
Click to expand...
Click to collapse
Yes that's exactly what I think and have been told. Can you give me a hint where I find this key and how I have to sign the app?
The only thing I could find is here:
http://wiki.cyanogenmod.com/index.php?title=How_to_build_a_kernel_port_for_CM6
but that's related to kernel and zip signing?
Thx
PS: And just for the records the manifest
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp.sl33p"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:permission="android.permission.DEVICE_POWER">
<activity android:name=".sl33p"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="1" />
<uses-permission android:name="android.permission.DEVICE_POWER" />
</manifest>
<uses-permission android:name="android.permission.DEVICE_POWER" />

well, the other choice perhaps is to compile your app with the Android ROM tree.

Related

[Q] My code throws exceptions

Hello, i am new to development for android and i am trying to make a simple app for me to learn how to code in java.
The idea was to make an app that you can use to send a text (yes, i could just use the messaging app, but that's no fun) and after fiddling with my code quite a bit i made it run on the emulator.
everything works other than when i send the message; an error is thrown (sending a message using the messaging app works though, and the message appears on the other emulator)
The emulators are both running 4.0.3, only one has the app installed
here is the error:
Thread [<1> main] (Suspended (exception IllegalArgumentException))
and for the full stack you can visit this link: http://pastebin.com/Sdc4RshX
and for the code please go here: http://pastebin.com/4xXDTbD1
what would have caused the issue, and what should i do to fix it?
Thanks
Have you added the user permission in the android manifest for sending SMS?
Code:
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
learning Java under Android is a really bad idea, just learn how to use Java with the JDK under a desktop OS.
dillonr, check this:
cheznutts said:
Have you added the user permission in the android manifest for sending SMS?
Code:
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
Click to expand...
Click to collapse
Also, you need to provide a PendingIntent as fourth argument to sendTextMessage method (as described here).
i did/do have the permission in the android manifest
should edit the first post, i am trying to make a simple app to learn how to code in java for android...i have a few ideas for better apps, gotta learn the basics first.
i understand how the views work, and how the files are placed...so i'm learning some things, and it is similar to when i used to code a few years ago in flash (like classes, variables, if...etc.)
EDIT: i un-commented the parts i commented out previously (including the PendingIntent)
http://pastebin.com/cH4NMTwM
still throwing the same error
Thread [<1> main] (Suspended (exception IllegalArgumentException))
I also noticed this
SmsManager.sendTextMessage(String, String, String, PendingIntent, PendingIntent) line: 77
but i do not have a line 77, and nothing seems to be wrong with my code (that i can see, anyway)
Could you post your AndroidManifest.xml and layout XML would like to see the declarations.
manifest
http://pastebin.com/L6VU7bJV
layout
http://pastebin.com/yAB6ia4Q
ho[e this helps you help me
I went ahead and made a project using your code. I commented out the pending intent, I opened up two emulators. One with port 5554 and another with 5556. Now I compiled your code on 5556 and then text to 5554 and it went through fine, no exceptions. Here is what Im looking at in the Activity:
Code:
package com.example.test;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.telephony.SmsManager;
public class MainActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public void csend(View view) {
String _number = this.getString(R.string.number);
String _message = this.getString(R.string.message);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(_number, null, _message, null, null);
}
}
Here is my Android Manifest:
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I left the layout alone. I say try it again. Check SDK is up to date and try creating new emulator using a different API level.
i updated and made new emulators (google api level 16, and google api level 15)
then i made a new "android application project" with the name 'multisender'
i copied the code from the previous application and pasted it into the correct files in the new one
what eclipse should i be running for android development? (on a mac)
running the application causes errors on sending the text (to phone number 15555215556 or 5556; the number shown when a text is recieved, and the port number)
it says "unfortunately, multisender has stopped." on the screen and i get errors in the LogCat
here is a copy of the LogCat errors
Code:
07-11 12:23:57.177: E/Trace(919): error opening trace file: No such file or directory (2)
07-11 12:29:33.907: E/Trace(954): error opening trace file: No such file or directory (2)
07-11 12:32:11.908: E/AndroidRuntime(954): FATAL EXCEPTION: main
07-11 12:32:11.908: E/AndroidRuntime(954): java.lang.IllegalStateException: Could not execute method of the activity
07-11 12:32:11.908: E/AndroidRuntime(954): at android.view.View$1.onClick(View.java:3591)
07-11 12:32:11.908: E/AndroidRuntime(954): at android.view.View.performClick(View.java:4084)
07-11 12:32:11.908: E/AndroidRuntime(954): at android.view.View$PerformClick.run(View.java:16966)
07-11 12:32:11.908: E/AndroidRuntime(954): at android.os.Handler.handleCallback(Handler.java:615)
07-11 12:32:11.908: E/AndroidRuntime(954): at android.os.Handler.dispatchMessage(Handler.java:92)
07-11 12:32:11.908: E/AndroidRuntime(954): at android.os.Looper.loop(Looper.java:137)
07-11 12:32:11.908: E/AndroidRuntime(954): at android.app.ActivityThread.main(ActivityThread.java:4745)
07-11 12:32:11.908: E/AndroidRuntime(954): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 12:32:11.908: E/AndroidRuntime(954): at java.lang.reflect.Method.invoke(Method.java:511)
07-11 12:32:11.908: E/AndroidRuntime(954): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
07-11 12:32:11.908: E/AndroidRuntime(954): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-11 12:32:11.908: E/AndroidRuntime(954): at dalvik.system.NativeStart.main(Native Method)
07-11 12:32:11.908: E/AndroidRuntime(954): Caused by: java.lang.reflect.InvocationTargetException
07-11 12:32:11.908: E/AndroidRuntime(954): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 12:32:11.908: E/AndroidRuntime(954): at java.lang.reflect.Method.invoke(Method.java:511)
07-11 12:32:11.908: E/AndroidRuntime(954): at android.view.View$1.onClick(View.java:3586)
07-11 12:32:11.908: E/AndroidRuntime(954): ... 11 more
07-11 12:32:11.908: E/AndroidRuntime(954): Caused by: java.lang.IllegalArgumentException: Invalid destinationAddress
07-11 12:32:11.908: E/AndroidRuntime(954): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:77)
07-11 12:32:11.908: E/AndroidRuntime(954): at com.dillonregi.multisender.multisender.csend(multisender.java:71)
07-11 12:32:11.908: E/AndroidRuntime(954): ... 14 more
it seems like i have an "invalid destination address" but sending a text to those numbers works in the default sms app
and what would be the "method of the activity"?
sorry for all these questions, but maybe one day someone else will also have this problem
EDIT: so i found the problem...kind of...when i replaced the line
sms.sendTextMessage(_number, null, _message, sentPI, null);
with
sms.sendTextMessage("5556", null, "test", null, null);
and ran it on the emulator (on port 5554) it sent "test" to the one on port 5556 with no errors!
Still wondering why i was getting errors with the variables there though
second edit: if either of the _number or _message variables are on that line it breaks...sentPI does not break it
okay, so i found the problem with the _number and _message
they were not defined in my strings.xml
the only problem is i cannot change who i send it to, or what the message is, even when i change what the text boxes say in the application...so my new question is how can i change a variable using an editable text box? (or how can i check what is in the text box before sending the text?)
EDIT: okay, i think i fixed it....
"
EditText number = (EditText)findViewById(R.id.pnumber);
EditText message = (EditText)findViewById(R.id.pmessage);
String _number = number.getText().toString();
String _message = message.getText().toString();
"
then
" sms.sendTextMessage(_number, null, _message, sentPI, null);
"
hope this helps other people
thanks everyone

[Q]Error at setting up a larger library project Android

Since I can not post links but they are necessary to not post a lot of code, I removed the prefixes in the beginning. They begin with the URL:
Want to start a standalone android project with a button in another project. First made a simple main app with a button that was referring to another project with Hello World with "is Library in Preferences". All according URL: developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject and it worked without problems.
Did the same thing with an open soruce project (puzzle) URL: code.google.com/p/androidsoft/source/browse/#svn%2Ftrunk%2Fpuzzle but get an error message in LogCat and my appa crashes when I click the button in my main app.
Guess I may have missed something in AndroidManifest.xml According to the documentation it says
Code:
Declaring library components in the manifest file: You must declare any <activity>, <service>, <receiver>, <provider>, and so on, as well as <permission>, <uses-library>.
I can compile puzzle as their own project without any problems. If the puzzle is a library will not work.
My main app with a button that will start the second project
Code:
public class AppActivity extends Activity {
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
addListenerOnButton();
}
public void addListenerOnButton() {
final Context context = this;
button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(context, org.androidsoft.games.puzzle.kids.MainActivity.class);
startActivity(intent);
}
});
}
}
AndroidManifest.xml in my main app with android:name="org.androidsoft.games.puzzle.kids.MainActivity
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="schemas.android.com/apk/res/android"
package="com.mkyong.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".AppActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.androidsoft.games.puzzle.kids.MainActivity">
</activity>
</application>
</manifest>
AndroidManifest.xml in puzzle that I want to use as a library URL: code.google.com/p/androidsoft/source/browse/trunk/puzzle/AndroidManifest.xml
LogCat error
Code:
08-08 12:44:31.607: E/AndroidRuntime(780): FATAL EXCEPTION: main
08-08 12:44:31.607: E/AndroidRuntime(780): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mkyong.android/org.androidsoft.games.puzzle.kids.MainActivity}: java.lang.NullPointerException
08-08 12:44:31.607: E/AndroidRuntime(780): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.os.Handler.dispatchMessage(Handler.java:99)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.os.Looper.loop(Looper.java:137)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.app.ActivityThread.main(ActivityThread.java:4745)
08-08 12:44:31.607: E/AndroidRuntime(780): at java.lang.reflect.Method.invokeNative(Native Method)
08-08 12:44:31.607: E/AndroidRuntime(780): at java.lang.reflect.Method.invoke(Method.java:511)
08-08 12:44:31.607: E/AndroidRuntime(780): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-08 12:44:31.607: E/AndroidRuntime(780): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-08 12:44:31.607: E/AndroidRuntime(780): at dalvik.system.NativeStart.main(Native Method)
08-08 12:44:31.607: E/AndroidRuntime(780): Caused by: java.lang.NullPointerException
08-08 12:44:31.607: E/AndroidRuntime(780): at org.androidsoft.games.puzzle.kids.AbstractMainActivity.onCreate(AbstractMainActivity.java:81)
08-08 12:44:31.607: E/AndroidRuntime(780): at org.androidsoft.games.puzzle.kids.MainActivity.onCreate(MainActivity.java:57)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.app.Activity.performCreate(Activity.java:5008)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
08-08 12:44:31.607: E/AndroidRuntime(780): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
08-08 12:44:31.607: E/AndroidRuntime(780): ... 11 more

[Q] Receive a broadcast AFTER user click on OK button AFTER uninstall was completed?

I placed all the receiver tags in AndroidManifest.xml:
Code:
<receiver android:name="my.package.MyBroadcastReceiver" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
And implemented my BroadcastReceiver subclass:
Code:
public class MyBroadcastReceiver extends BroadcastReceiver {
[user=439709]@override[/user]
public void onReceive( final Context context, final Intent intent ) {
Log.w( "RECEIVED!!!!!!!" );
}
}
This works very fine!!! But... The onReceive method is called AFTER uninstall was completed but BEFORE users press OK at confirmation activity showed by native system.
I wanna, if exists, receive a broadcast AFTER user press OK.
Thanks!

Want to add activity in Settings.apk file

I want to add activity in Settings.apk, for that I have created Activity in below path
/home/amit/android/lineage/packages/apps/Settings/src/com/android/settings/network
I have declared AirplaneModePreference activity in AndroidManifest.xml like below
Code:
<activity android:name="com.android.settings.network.AirplaneModePreference"
android:taskAffinity="com.android.settings"
android:configChanges="orientation|keyboardHidden|screenSize"
android:parentActivityName="Settings"
android:label="Advance Airplane Mode">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
But still, when I start the AirplaneModePreference activity, I am getting following error
Code:
Process: com.android.settings, PID: 24946
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings.network/com.android.settings.network.AirplaneModePreference}; have you declared this activity in your AndroidManifest.xml (which is in Settings/AndroidManifest.xml) ?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2005)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673)
at android.app.Activity.startActivityForResult(Activity.java:4587)
at android.app.Activity.startActivityForResult(Activity.java:4545)
at android.app.Activity.startActivity(Activity.java:4906)
at android.app.Activity.startActivity(Activity.java:4874)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:379)
at android.support.v7.preference.Preference.performClick(Preference.java:1139)
at com.android.settingslib.RestrictedPreference.performClick(RestrictedPreference.java:78)
at android.support.v7.preference.Preference.performClick(Preference.java:1107)
at android.support.v7.preference.Preference$1.onClick(Preference.java:172)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25906)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6729)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Do you have any idea, then please let me know, thanks a lot in advance

Access to serial port on Android device

Hi Guys,
Currently I am working on an application build in Unity that controls Numato Lab USBGPIO8 module (it will simply turn on and off channels on gpio when conditions in a separate script in app would be met). Whole project is based on ARFoundation.
Opening and controlling serial port using Unity editor and PC works fine (my PC uses COM4 port). However, when building on Android I am getting an "IOException error: permission denied" when script tries to open serial port (gpio is now connected to smartphone through usb cable):
IOException: Permission denied
System.IO.Ports.SerialPortStream.ThrowIOException () (at :0) System.IO.Ports.SerialPortStream..ctor (System.String portName, System.Int32 baudRate, System.Int32 dataBits, System.IO.Ports.Parity parity, System.IO.Ports.StopBits stopBits, System.Boolean dtrEnable, System.Boolean rtsEnable, System.IO.Ports.Handshake handshake, System.Int32 readTimeout, System.Int32 writeTimeout, System.Int32 readBufferSize, System.Int32 writeBufferSize) (at :0) (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPortStream..ctor(string,int,int,System.IO.Ports.Parity,System.IO.Ports.StopBits,bool,bool,System.IO.Ports.Handshake,int,int,int,int) System.IO.Ports.SerialPort.Open () (at :0) (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPort.Open() SerialConnector.OpenPort () (at :0) SerialConnector.Start () (at :0)
Click to expand...
Click to collapse
USB Device Info app shows the device path is /dev/bus/usb/001/002, so I use this as a port adress in the script:
C#:
using UnityEngine;
using System.IO.Ports;
using System.Threading;
public class SerialConnector : MonoBehaviour
{
SerialPort serialPort = new SerialPort("/dev/bus/usb/001/002");
//COM4 in unity editor pc
void Start()
{
OpenPort();
GPIOSetChannelOn(1);
}
private void OpenPort()
{
Debug.Log("Opening port");
if (!serialPort.IsOpen)
serialPort.Open();
serialPort.BaudRate = 19200;
}
private void GPIOSetChannelOn(int channel)
{
...
}
private void GPIOSetChannelOff(int channel)
{
...
}
}
I have added a line to manifest file, that allows external read write using custom AndroidManifest.xml file in Assets/Plugins/Android folder:
JavaScript:
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools" package="com.unity3d.player" xmlns:android="http://schemas.android.com/apk/res/android" tools:node="merge">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application>
<activity android:theme="@style/UnityThemeSelector" android:name="com.unity3d.player.UnityPlayerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
</activity>
</application>
</manifest>
Despite these steps, the problem persists. Is there a way to resolve this issue without rooting my smartphone?

Categories

Resources