Unable to add Android manifest Permissions -


I am working on an Android Library Project for a week and there is no problem till now. But now I have implemented a bit code to check the network status as the following:

  Obtain a Public Boolean Network Stats (Activity Activity) {Connectivity Manager CM; NetworkInfo netInfo = Faucet; {Cm = (Connectivity Manager) Activity .getSystemService (context.CONNECTIVITY_SERVICE) Try it; NetInfo = cm.getActiveNetworkInfo (); } Hold (exception e) {log d. ("Mock", e); } If (netInfo! = Null & netInfo.isConnected ()) {return true; } return false; }   

My log D error returns that I'm missing ACCES_NETWORK_STATE permission. This is where the trouble starts ..

When I opened my manifest. XML I'm not able to add a permission (already 3 others). When I click on adding it, a blank window says: Due to the random pigment, create a new element at the top level in the temporary descriptor.

Trying to add permission to the manifest is not the work of ether. This code is not compliant, but only says that I still have not got permission.

In addition to this manifest. XML started warning me: Clearly set Android: Icon is not a default, but I do not need an icon to work on a library project.

Clear me:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Manifest xmlns: Android = "http://schemas.android.com/apk/res/android" package = "nl.test.projectInternet" Android: versionCode = "1" Android: versionName = "1.0" & gt; & Lt; Use-sdk android: minSdkVersion = "10" Android: targetSdkVersion = "19" /> & Lt; Usage-permission Android: name = "android.permission.INTERNET" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_FINE_LOCATION" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_COARSE_LOCATION" /> & Lt; Application Android: label = "projectInternet" Android: allowBackup = "false" & gt; & Lt; Activity Android: name = ". ProjectInternet" android: label = "projectInternet" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; & Lt; / Application & gt; & Lt; / Reveal & gt;   

Exact exception has been received: neither the Android Period in the current process of user 10021. ACCCN_net is a warcourt.

Nobody knows what I have done / what to do to fix it?

Remember: the code is working properly on any other Android project. Now I am working on a library and I am not able to add permission! Just add it XML Wont work

You can follow me step-by-step: like

Add permission to the first AndroidMenifest.xml file. & lt; Usage-permission Android: name = "android.permission.INTERNET" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_NETWORK_STATE" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_FINE_LOCATION" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_COARSE_LOCATION" />

Add another checkInternet class

  Import android.content.Context; Import android.net Connectivity Manager; Import android.net NetworkInfo; Public class checkinCentrete (Public Static Boolean CheckCon (Reference CTX) (Connectivity Manager conMgr = (Connectivity Manager) ctx.getSystemService (reference. CONNECTIVITY_SERVICE); NetworkInfo info = conMgr.getActiveNetworkInfo (); if (info == faucet) return false; (! Info.isconnected ()) returned incorrect; if (Info.is available ()) returned false; return true;}}   

and finally check the Internet from your activity Like

  if (CheckInternet.checkCon (getBaseContext ())) {// Internet connect OK} else {// Internet connection Not correct}    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -