添加权限申请

更新 jpush appkey
hmxc
张萌 3 years ago
parent cac11a76a3
commit b1e3574ea6

@ -5,7 +5,8 @@
additional functionality it is fine to subclass or reimplement additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. --> FlutterApplication and put your custom class here. -->
<application android:name="io.flutter.app.FlutterApplication" android:label="小蜜蜂智慧社区管家端" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true"> <application android:name="io.flutter.app.FlutterApplication" android:label="小蜜蜂智慧社区管家端" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true">
<meta-data android:name="com.amap.api.v2.apikey" android:value="872b909f2ebc8150b809d692c4349f22"/> <service android:name="com.amap.api.location.APSService"/>
<meta-data android:name="com.amap.api.v2.apikey" android:value="01b4902aa29bd50ae71ccc2c920ceb10"/>
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> <activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user the Android process has started. This theme is visible to the user
@ -30,4 +31,28 @@
android:resource="@xml/network_security_config"/> android:resource="@xml/network_security_config"/>
</application> </application>
<!--允许程序打开网络套接字-->
<uses-permission android:name="android.permission.INTERNET" />
<!--允许程序设置内置sd卡的写权限-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--允许程序获取网络状态-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--允许程序访问WiFi网络信息-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!--允许程序读写手机状态和身份-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!--允许程序访问CellID或WiFi热点来获取粗略的位置-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 保存照片到相册 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 打开相册选取图片 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--获取相机权限-->
<uses-permission android:name="android.permission.CAMERA" />
<!-- <activity android:name="com.apptreesoftware.barcodescan.BarcodeScannerActivity"/> -->
<!--获取网络-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest> </manifest>

@ -55,13 +55,13 @@ void main() async {
}, },
); );
jpush.setup( jpush.setup(
appKey: "99067fe33fa04aad88c3acac", appKey: "028adb7b9eda661fefdf3072",
channel: "developer-default", channel: "developer-default",
production: false, production: false,
debug: true, // debug debug: true, // debug
); );
String? id = await JPush().getRegistrationID(); String? id = await JPush().getRegistrationID();
print(id); print('jpush RegistrationID is $id');
LoggerData.addData(id); LoggerData.addData(id);
runApp(MyApp()); runApp(MyApp());
} }

@ -8,6 +8,7 @@ import 'package:amap_flutter_location/amap_location_option.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/ui/home/application/applications_page.dart'; import 'package:aku_community_manager/ui/home/application/applications_page.dart';
import 'package:power_logger/power_logger.dart';
enum WORKCLOCK { enum WORKCLOCK {
/// ///
@ -51,6 +52,8 @@ class AppProvider extends ChangeNotifier {
_flutterLocation = AMapFlutterLocation(); _flutterLocation = AMapFlutterLocation();
_flutterLocation.onLocationChanged().listen((event) { _flutterLocation.onLocationChanged().listen((event) {
_location = event; _location = event;
LoggerData.addData(_location.toString());
print(_location.toString());
if (_location != null) { if (_location != null) {
stopLocation(); stopLocation();
} }
@ -65,8 +68,6 @@ class AppProvider extends ChangeNotifier {
_flutterLocation.destroy(); _flutterLocation.destroy();
} }
WORKCLOCK _clockStatus = WORKCLOCK.NOTIN; WORKCLOCK _clockStatus = WORKCLOCK.NOTIN;
DateTime? _clockInTime; DateTime? _clockInTime;
DateTime? _clockOutTime; DateTime? _clockOutTime;

@ -35,8 +35,10 @@ class UserProvider extends ChangeNotifier {
await HiveStore.appBox!.put('login', true); await HiveStore.appBox!.put('login', true);
_profileModel = await updateProfile(); _profileModel = await updateProfile();
_infoModel = await updateUserInfo(); _infoModel = await updateUserInfo();
if (isLogin) {
WebSocketUtil().setUser(infoModel!.id.toString()); WebSocketUtil().setUser(infoModel!.id.toString());
WebSocketUtil().startWebSocket(); WebSocketUtil().startWebSocket();
}
// await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true) // await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true)
// ? '' // ? ''
// : _userDetailModel?.estateNames?.first); // : _userDetailModel?.estateNames?.first);
@ -68,6 +70,7 @@ class UserProvider extends ChangeNotifier {
else { else {
var userModel = UserInfoModel.fromJson(model.data); var userModel = UserInfoModel.fromJson(model.data);
JPush().setAlias(userModel.id.toString()); JPush().setAlias(userModel.id.toString());
print('jpush alias is ${userModel.id}');
return userModel; return userModel;
} }
} }

Loading…
Cancel
Save