万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    KotlinでURIからString変換

    content:/media/external/video/media/19 みたいなのが変換されずに困った。単にtoString()しても失敗する

    これをすると https://stackoverrun.com/ja/q/2497866 MediaStore.Images.Media.DATAがdeprecatedだしな。

        /**
         * Android 10以降で使用するためのURLからPathの変換
         *
         * @param context Activity.
         * @param uri URI
         */
        fun getPath(context: Context?, uri: Uri): String? {
            var cursor: Cursor? = null
            val column = "_data"
            val projection = arrayOf(column)
    
            try {
                cursor = context!!.contentResolver.query(uri!!, projection, null,
                        null, null)
                if (cursor != null && cursor.moveToFirst()) {
                    val columnIndex: Int = cursor.getColumnIndexOrThrow(column)
                    return cursor.getString(columnIndex)
                }
            } catch (e: Exception) {
                e.printStackTrace()
            } finally {
                cursor?.close()
            }
    
            return null
        }

    https://stackoverflow.com/questions/3401579/get-filename-and-path-from-uri-from-mediastore

    ここからパクってまとめた。

    Android Flash Tool を使用する Android 11の実験

    ここからやる。zipではない? https://developer.android.com/preview/download#flash

    開発者向けオプション

    f:id:shinriyo:20200603110453p:plain
    開発者向けオプション

    OEMの設定

    f:id:shinriyo:20200603110130p:plain
    OEM

    この辺選ぶ

    f:id:shinriyo:20200603110549p:plainf:id:shinriyo:20200603110549p:plain

    f:id:shinriyo:20200603110538p:plain

    ここそのままf:id:shinriyo:20200603110609p:plain

    INSTALLのときはf:id:shinriyo:20200603120222p:plain ここれがPreviewAndroid 11になってるか見ないと10の奴が入る・・・

    あとで画面で 「Your device unexpectantly appeared as an ADB device. Choose "Reboot into Bootloader" to reboot to the bootloader.」 押した。 f:id:shinriyo:20200603110520p:plainf:id:shinriyo:20200603110520p:plain

    ここ参考になる? mobilelaby.com

    ブートローダーをアンロックしていない場合、途中でインストールが止まります。音量ボタンと電源ボタンを操作してブートローダーをアンロックしてください

    この箇所が重要。 Unlock Bootloaderを

    Flutter web - Upload Image File to Firebase Storage

    Flutter for Webで「Firebase Storage」連携。

    一番マトモっぽいPluginはなぜか使えん https://github.com/FirebaseExtended/flutterfire/issues/2687

    この2つかな?

    https://dev.to/happyharis/flutter-web-firebase-storage-2ac1?fbclid=IwAR0HE95PSCYVSgbyL2xPhPFJQ6P0t8rvMNDAtl7EJy69jSD9-uogj-W7PeM

    https://stackoverflow.com/questions/59716944/flutter-web-upload-image-file-to-firebase-storage?fbclid=IwAR1Vs2MRgTs5LscebucgBqmz7xR9GskgXVCQDCBHXlnzOQZY28W0NpMtfu0

    stackoverflowのやつでこれ

    Uncaught (in promise) TypeError: dart.global.firebase.storage is not a function
        at Object.storage$ [as storage] (top_level.dart:113)
        at uploadImageFile (banners.dart:244)
        at uploadImageFile.next (<anonymous>)
        at runBody (async_patch.dart:86)
        at Object._async [as async] (async_patch.dart:125)
        at uploadImageFile (banners.dart:241)
        at banners.dart:253
        at Generator.next (<anonymous>)
        at runBody (async_patch.dart:86)
        at Object._async [as async] (async_patch.dart:125)
        at ink_well.InkWell.new.<anonymous> (banners.dart:240)
        at _InkResponseState.new.[_handleTap] (ink_well.dart:772)
        at ink_well.dart:855
        at tap.TapGestureRecognizer.new.invokeCallback (recognizer.dart:182)
        at tap.TapGestureRecognizer.new.handleTapUp (tap.dart:522)
        at tap.TapGestureRecognizer.new.[_checkUp] (tap.dart:282)
        at tap.TapGestureRecognizer.new.handlePrimaryPointer (tap.dart:217)
        at tap.TapGestureRecognizer.new.handleEvent (recognizer.dart:475)
        at pointer_router.PointerRouter.new.[_dispatch] (pointer_router.dart:76)
        at pointer_router.dart:122
        at LinkedMap.new.forEach (linked_hash_map.dart:23)
        at pointer_router.PointerRouter.new.[_dispatchEventToRoutes] (pointer_router.dart:120)
        at pointer_router.PointerRouter.new.route (pointer_router.dart:106)
        at binding$5.WidgetsFlutterBinding.new.handleEvent (binding.dart:218)
        at binding$5.WidgetsFlutterBinding.new.dispatchEvent (binding.dart:198)
        at binding$5.WidgetsFlutterBinding.new.[_handlePointerEvent] (binding.dart:156)
        at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue] (binding.dart:102)
        at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket] (binding.dart:86)
        at Object._invoke1 (window.dart:592)
        at _engine.EngineWindow.new.invokeOnPointerDataPacket (window.dart:238)
        at _engine.PointerBinding.__.[_onPointerData] (pointer_binding.dart:129)
        at pointer_binding.dart:479
        at pointer_binding.dart:440
        at pointer_binding.dart:210

    よくわからんが web/index.html

      <script src="https://www.gstatic.com/firebasejs/7.14.0/firebase-storage.js"></script>

    追加してみる

    Flutter

    Expected a value of type 'Map<String, dynamic>', but got one of type 'LinkedMap<dynamic, dynamic>'

    Firebaseの

      Future<Null> update(
              {Map<String, dynamic> data,
              List< /*String|FieldPath|dynamic*/ dynamic> fieldsAndValues}) =>
          handleThenable(_wrapUpdateFunctionCall(jsObject, data, fieldsAndValues));

    を使う。

    document.ref.update(
         data: value,
    );

    で入れるが、value

    // <String, dynamic>を書かないとだめ
    // var updated = {};
    var updated = <String, dynamic>{};
    var index = 0;
    for (var prop in props) {
        updated[prop] = list[index].text;
        index++;
    }